﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Attributes;

namespace SelfService.Model.Models 
{
    public class SysClient : BasePoco
    {
        [Display(Name = "名称")]
        [StringLength(64)]
        public string Name { get; set; }

        [Display(Name = "编码")]
        [StringLength(64)]
        public string Code { get; set; }

        [Display(Name = "位置")]
        [StringLength(64)]
        public string Address { get; set; }

        [Display(Name = "IP")]
        [StringLength(64)]
        [Required]
        public string Ip { get; set; }

        [Display(Name = "Mac地址")]
        [StringLength(64)]
        public string MacAddress { get; set; }

        [Display(Name = "版本号")]
        [StringLength(64)]
        public string Version { get; set; }

        [Display(Name = "功能列表")]
        public List<ClientModules> Modules { get; set; }

        [Display(Name = "硬件列表")]
        public List<ClientDevice> Devices { get; set; }

        [Display(Name = "卡片类型")]
        public List<ClientCardType> CardTypes{ get; set; }

        [Display(Name = "支付方式")]
        public List<ClientPayTypes> PayTypes { get; set; }

        [Display(Name = "诊室列表")]
        public List<ClientRooms> Rooms { get; set; }

        [Display(Name = "开启更新")]
        public bool IsUpdate { get; set; }
        
        [Display(Name = "最后通讯时间")]
        public DateTime? LastTime { get; set; }

        [Display(Name = "登录时间")]
        public DateTime? LoginTime { get; set; }

        [Display(Name = "主题")]
        public SysTheme Theme { get; set; }

        [Display(Name = "主题")]
        public Guid? ThemeId { get; set; }

        [Display(Name = "用户")]
        public FrameworkUser User { get; set; }

        [Display(Name = "用户ID")]
        [Required]
        public Guid? UserId { get; set; }
    }

    [MiddleTable]
    public class ClientModules : BasePoco
    {
        [JsonIgnore]
        public SysClient Client { get; set; }

        public SysModule Module { get; set; }

        public Guid ClientId { get; set; }

        public Guid ModuleId { get; set; }
    }

    [MiddleTable]
    public class ClientDevice : BasePoco
    {
        [JsonIgnore]
        public SysClient Client { get; set; }

        public SysDevice Device { get; set; }

        public Guid ClientId { get; set; }

        public Guid DeviceId { get; set; }
    }

    [MiddleTable]
    public class ClientCardType : BasePoco
    {
        [JsonIgnore]
        public SysClient Client { get; set; }

        public SysCardType CardType { get; set; }

        public Guid ClientId { get; set; }

        public Guid CardTypeId { get; set; }
    }

    [MiddleTable]
    public class ClientPayTypes : BasePoco
    {
        [JsonIgnore]
        public SysClient Client { get; set; }

        public SysPayType PayType { get; set; }

        public Guid ClientId { get; set; }

        public Guid PayTypeId { get; set; }
    }

    [MiddleTable]
    public class ClientRooms : BasePoco
    {
        [JsonIgnore]
        public SysClient Client { get; set; }

        public SysRoom Room { get; set; }

        public Guid ClientId { get; set; }

        public Guid RoomId { get; set; }
    }
}
